<?php
	include "../../public/commom/config.php";
	include "../lock1.php";	
?>

<!DOCTYPE html>
<html>
	
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css">
		<link rel="stylesheet" type="text/css" href="../public/css/index.css"/>
	</head>
	
	<body>
		<div id="main">
			<h1>用户表</h1>
			<table class="table table-bordered">
				<thead>
					<tr><th>编号</th><th>用户名</th><th>密码</th><th>权限</th><th>操作</th><th>操作</th></tr>
				</thead>
				<tbody>
					<?php
						$sql = "SELECT * FROM user WHERE rule!=0";
					
						$result = mysqli_query($conn, $sql);
						
						$arr = array("超级管理员","中级管理员","普通管理员");
						
						while($row = mysqli_fetch_array($result)) {
							echo "<tr>
									<td>" . $row["id"] . "</td>
									<td>" . $row["username"] . "</td>
									<td>" . $row["password"] . "</td>
									<td>" . $arr[$row["rule"]] . "</td>
									<td><a href='xiugai.php?id=" . $row["id"] . "'>修改</a></td>
									<td><a href='delete.php?id=" . $row["id"] . "'>删除</a></td>
								</tr>";
						} 
						
						mysqli_close($conn);
					?>
				</tbody>
				
			</table>
		</div>
	</body>
	
</html>